<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/9/28 0028
  Time: 下午 14:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
    <jsp:include page="${pageContext.request.contextPath }/resource_path.jsp" flush="true"/>

    <style>
        .layui-form-label{
            width: 100px;
        }
        .layui-input-block {
            margin-left: 130px;
            min-height: 36px
        }
    </style>
</head>
<body class="layui-anim layui-anim-up">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>阿米巴报表</cite>
        </a>
      </span>
</div>
<div class="x-body">
    <div class="layui-row">
        <div class="layui-form layui-col-md12" >
            <div class="layui-input-inline">

                    <div class="layui-input-inline" style="width: 165px">
                        <select name="keyword1" id="keyword1">
                            <c:forEach items="${warehouseList}" var="warehouse">
                                <option value="${warehouse.id}">${warehouse.warehouse_name}</option>
                            </c:forEach>
                        </select>
                    </div>

                    <input type="hidden" id="dateTime">

                    <div class="layui-input-inline" style="width: 150px">
                        <input class="layui-input" id="date1"  style="width: 150px">
                    </div>

                    <button class="layui-btn layui-btn-normal" data-type="reload"><i class="layui-icon layui-icon-search"></i>检索</button>

            </div>
        </div>
    </div>
    <table class="layui-hide" id="tableList" lay-filter="tableList"></table>

    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col>
        </colgroup>
        <tbody>
        <tr>
            <td rowspan="21">支出（含税）（B）</td>
            <td rowspan="19">巴内支出（b1）</td>
            <td>房租</td>
            <td>房租&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td contentEditable="true" id="fangZu">0</td>
            <td></td>
        </tr>
        <tr>

            <td></td>
            <td>物业</td>
            <td></td>
            <td contentEditable="true" id="wuYe">0</td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>水电</td>
            <td></td>
            <td contentEditable="true" id="shuiDian">0</td>
            <td></td>
        </tr>
        <tr style="background-color: #ccc">
            <td></td>
            <td>合计</td>
            <td></td>
            <td id="fangZuHeJi">0</td>
            <td></td>
        </tr>
<script>

    var temp1 = 0;
    var temp2 = 0;
    var temp3 = 0;

    var dateTime = $('#dateTime').val();
    if (dateTime.length < 4) {
        var time = new Date();
        var day = ("0" + time.getDate()).slice(-2);
        var month = ("0" + (time.getMonth() + 1)).slice(-2);
        var today = time.getFullYear() + "-" + (month);
        dateTime = today;
    }
    dateTime = dateTime.replace(/-/g,'')
    /*验证单价：包括两位小数*/
    var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;

    $('#fangZu').keyup(function () {
        temp1 = $('#fangZu').text()

        if (temp1 == '') {
            temp1 = 0;
        }

        $('#fangZuHeJi').text(parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))



        $('#b1Fei').text(parseFloat(yuangShi)+ parseFloat($('#gGongFenTan').text()) + parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))

        if (!priceReg.test(temp1)){
            toastr.warning("请输入正确的价格:整数或者保留两位小数");
            return false;
        }
        save(temp1,null,null)

    });
    $('#wuYe').keyup(function () {
        temp2 = $('#wuYe').text()
        if (temp2 == '') {
            temp2 = 0;
        }
        $('#fangZuHeJi').text(parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))
        $('#b1Fei').text(parseFloat(yuangShi)+ parseFloat($('#gGongFenTan').text()) + parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))

        if (!priceReg.test(temp2)){
            toastr.warning("请输入正确的价格:整数或者保留两位小数");
            return false;
        }
        save(null,temp2,null)
    });
    $('#shuiDian').keyup(function () {
        temp3 = $('#shuiDian').text()

        if (temp3 == '') {
            temp3 = 0;
        }
        $('#fangZuHeJi').text(parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))
        $('#b1Fei').text(parseFloat(yuangShi)+ parseFloat($('#gGongFenTan').text()) + parseFloat(temp1)+parseFloat(temp2)+parseFloat(temp3))

        if (!priceReg.test(temp3)){
            toastr.warning("请输入正确的价格:整数或者保留两位小数");
            return false;
        }
        save(null,null,temp3)
    });

    function save(temp1,temp2,temp3) {
        //仓库
        var keyword1 = $('#keyword1').val()
        $.ajax({
            type:"POST",
            url: "/amoeba/amoebaUpdateByFZ.do",
            //contentType: "application/json",
            data:{
                id:dateTime,
                parameter5:temp1,
                parameter6:temp2,
                parameter7:temp3,
                parameter8:null,
                type:keyword1
            }
        })
    }


</script>
        <tr>
            <td>设备</td>
            <td>货架</td>
            <td></td>
            <td><span id="huoJia"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>叉车&扫地车折旧</td>
            <td></td>
            <td><span id="chaCheZheJiu"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>叉车租赁</td>
            <td></td>
            <td><span id="cheZuLin"></span></td>
            <td></td>
        </tr>
        <tr style="background-color: #ccc">
            <td></td>
            <td>合计</td>
            <td></td>
            <td><span id="sheBei"></span></td>
            <td></td>
        </tr>

        <tr>
            <td>人工</td>
            <td>工资</td>
            <td></td>
            <td><span id="gongZi"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>社保</td>
            <td></td>
            <td><span id="sheBaoFei"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>分公司经理</td>
            <td></td>
            <td><span id="fenGongSiJingLi"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>服务费</td>
            <td></td>
            <td><span id="fuWuFei"></span></td>
            <td></td>
        </tr>
        <tr style="background-color: #ccc">
            <td></td>
            <td>合计</td>
            <td></td>
            <td id="renGong"></td>
            <td></td>
        </tr>


        <tr>
            <td>运输</td>
            <td>油费</td>
            <td></td>
            <td><span id="youFei"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>过桥</td>
            <td></td>
            <td><span id="guoQiaoFei"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>维修费</td>
            <td></td>
            <td><span id="weiXiuFei"></span></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>外雇车</td>
            <td></td>
            <td><span id="waiGuChe"></span></td>
            <td></td>
        </tr>

        <tr style="background-color: #ccc">
            <td></td>
            <td>合计</td>
            <td></td>
            <td><span id="yunShuFei"></span></td>
            <td></td>
        </tr>

        <tr>
            <td>其他</td>
            <td>明细${fenGongSiMingXi}+折旧${zheJiuFie}+待摊${daiTan}+其他${qiTa}</td>
            <td></td>
            <td><span id="qiTa"></span></td>
            <td></td>
        </tr>

        <tr>
            <td>公共分摊（b2）</td>
            <td></td>
            <td>重庆分公司+总部</td>
            <td></td>
            <td contentEditable="true" id="gGongFenTan">0</td>
            <td>总部分摊无明细</td>
        </tr>

        <tr style="background-color: #ccc">
            <td colspan="2">合计=b1+b2</td>
            <td></td>
            <td></td>
            <td><span id="b1Fei"></span></td>
            <td></td>
        </tr>

        <tr>
            <td>收益（C）</td>
            <td colspan="2">C=A-B</td>
            <td></td>
            <td></td>
            <td><span id="shouyi"></span></td>
            <td></td>
        </tr>

        <tr>
            <td>项目利润率</td>
            <td colspan="4">（项目利润／收入＊100%）</td>

            <td><span id="liRunLv"></span></td>
            <td></td>
        </tr>

        </tbody>
    </table>


</div>

<div id="addDivID" style="display:none">
    <form class="layui-form" id="addFormID" style="margin-top:20px">

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">仓库：</label>
                <div class="layui-inline">
                    <select  name="warehouse">
                        <option value="租赁">蔡家</option>
                        <option value="折旧">蔡家</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">方式：</label>
                <div class="layui-inline">
                    <select  name="type" lay-filter="changType">
                        <option value="租赁">租赁</option>
                        <option value="折旧">折旧</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item" id="brand1" >
            <div class="layui-inline">
                <label class="layui-form-label">品牌：</label>
                <div class="layui-inline">
                    <input type="text" class="layui-input" name="brand" style="width: 213px;">
                </div>
            </div>
        </div>

        <div class="layui-form-item"  id="brand2">
            <div class="layui-inline">
                <label class="layui-form-label">品牌：</label>
                <div class="layui-inline">
                    <select  name="parameter2">
                        <option value="">--请选择供应商--</option>
                        <c:forEach items="${depreciationEntity}" var="item">
                            <%--<option value="${item.id}" >${item.itemName}</option>--%>
                            <option value="${item.itemName}" >${item.itemName}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">金额：</label>
                <div class="layui-inline">
                    <input type="text" class="layui-input" name="parameter" style="width: 213px;">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <button class="layui-btn layui-btn-blue" id="subBtn" lay-submit lay-filter="addForm" style="margin-left: 90px; margin-bottom: 10px">提交</button>
                &emsp;&emsp;<button  class="layui-btn layui-btn-primary" style="margin-bottom: 10px">取消</button>
            </div>
        </div>
    </form>
</div>

<script>
    var temp = 0;
    var b1Fei = 0;
    var temp4 = 0;
    var yuangShi = 0;
    $('#gGongFenTan').keyup(function () {
        temp4 = $('#gGongFenTan').text()
        if (temp4 == '') {
            temp4 = 0;
        }




        $('#b1Fei').text(parseFloat(yuangShi)+ parseFloat($('#fangZuHeJi').text()) + parseFloat(temp4))

        var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
        if (!priceReg.test(temp4)){
            toastr.warning("请输入正确的价格:整数或者保留两位小数");
            return false;
        }

        var dateTime = $('#dateTime').val();
        if (dateTime.length < 4) {
            var time = new Date();
            var day = ("0" + time.getDate()).slice(-2);
            var month = ("0" + (time.getMonth() + 1)).slice(-2);
            var today = time.getFullYear() + "-" + (month);
            dateTime = today;
        }
        dateTime = dateTime.replace(/-/g,'')
        /*验证单价：包括两位小数*/



        $.ajax({
            type:"POST",
            url: "/amoeba/amoebaUpdateByFZ.do",
            //contentType: "application/json",
            data:{
                id:dateTime,
                parameter5:null,
                parameter6:null,
                parameter7:null,
                parameter8:temp4,
                type:$('#keyword1').val()
            }
        })



    })

    function getList(stockId,date) {

        $.ajax({
            type:"GET",
            async : false,
            url:'/amoeba/getList.do',
            data:{stockId:stockId,date:date},
            success:function (result) {
                console.log(result)

                /////////////////////////////////////////////////////////////////////
                //房租
                $('#fangZu').text(result.parameter5)
                //物业
                $('#wuYe').text(result.parameter6)
                //水电
                $('#shuiDian').text(result.parameter7)
                //合计
                $('#fangZuHeJi').text(result.parameter5+result.parameter6+result.parameter7)
                //公共分摊（b2）
                $('#gGongFenTan').text(result.parameter8)

                /////////////////////////////////////////////////////////////////////
                //货架
                $('#huoJia').text(result.huoJia)
                //叉车扫地车折旧
                $('#chaCheZheJiu').text(result.chaCheZheJiu)
                //叉车租赁
                $('#cheZuLin').text(result.chaChezuLin)
                //设备合计
                $('#sheBei').text(result.chaCheZheJiu + result.chaChezuLin + result.huoJia)

                //工资
                $('#gongZi').text(result.gongZi)
                //社保
                $('#sheBaoFei').text(result.sheBaoFei)
                //分公司总经理
                $('#fenGongSiJingLi').text(result.fenGongSiJingLi)
                //服务费
                $('#fuWuFei').text(result.fuWuFei)

                //合计
                $('#renGong').text(result.gongZi+result.sheBaoFei+result.fenGongSiJingLi+result.fuWuFei)

                /////////////////////////////////////////////////////////油费
                $('#youFei').text(result.youFei)
                //过桥
                $('#guoQiaoFei').text(result.guoQiaoFei)
                //维修费
                $('#weiXiuFei').text(result.weiXiuFei)
                //外雇车
                $('#waiGuChe').text(result.waiGuChe)
                //运输合计
                $('#yunShuFei').text(result.youFei + result.guoQiaoFei + result.weiXiuFei + result.waiGuChe)
                //////////////其他////////////////////////////////////////////
                $('#qiTa').text(result.qiTa)


                ///////////////合计=b1+b2////////////////////////////////////
                // 房租 result.parameter5+result.parameter6+result.parameter7
                // 设备 result.chaCheZheJiu + result.chaChezuLin+ result.huoJia
                // 人工 result.gongZi+result.sheBaoFei+result.fenGongSiJingLi+result.fuWuFei
                // 运输 result.youFei + result.guoQiaoFei + result.weiXiuFei + result.waiGuChe
                // 其他 result.qiTa
                $('#b1Fei').text(result.youFei + result.guoQiaoFei + result.weiXiuFei + result.waiGuChe+result.qiTa+result.chaCheZheJiu + result.chaChezuLin + result.huoJia +result.gongZi+result.sheBaoFei+result.fenGongSiJingLi+result.fuWuFei+result.parameter5+result.parameter6+result.parameter7)
                yuangShi = result.youFei + result.guoQiaoFei + result.weiXiuFei + result.waiGuChe+result.qiTa+result.chaCheZheJiu + result.chaChezuLin+ result.huoJia +result.gongZi+result.sheBaoFei+result.fenGongSiJingLi+result.fuWuFei + result.parameter5+result.parameter6+result.parameter7

                /////////////收益///////////////////////////////////////////////////
                console.log(result.partAPrice+"++++"+$('#b1Fei').text())


                console.log('---------------------')
                console.log(result.partAPrice)
                console.log($('#b1Fei').text())
                console.log()
                console.log()
                console.log('---------------------')

                $('#shouyi').text(result.partAPrice- parseFloat($('#b1Fei').text()))

                /////////////项目利润率///////////////////////////////////////////////////
                var liRunLv = (result.partAPrice- parseFloat($('#b1Fei').text()))/result.partAPrice

                if (isNaN(liRunLv)) {
                    return;
                }
                $('#liRunLv').text(liRunLv.toFixed(2))


            }
        })

    }



    $(document).ready(function () {
        var time = new Date();
        var day = ("0" + time.getDate()).slice(-2);
        var month = ("0" + (time.getMonth() + 1)).slice(-2);
        var today = time.getFullYear() + "-" + (month);
        $('#dateTime').val(today);

        getList($('#keyword1').val(),today);
    })
    layui.use(['table','layer','upload','form','laydate'], function(){
        var table = layui.table;
        var form=layui.form;
        var layer = layui.layer;

        var laydate = layui.laydate;
        laydate.render({
            elem: '#date1',
            type: 'month',
            value: new Date(),
            done:function(value, date, endDate) {
                $('#dateTime').val(value);
            }
        });
        laydate.render({
            elem: '#date2'
        });

        var $ = layui.jquery, active = {
            reload:function () {
                var dateTime = $('#dateTime').val();
                var keyword1 = $("#keyword1").val();
                if (dateTime.length < 4) {
                    var time = new Date();
                    var day = ("0" + time.getDate()).slice(-2);
                    var month = ("0" + (time.getMonth() + 1)).slice(-2);
                    var today = time.getFullYear() + "-" + (month);
                    dateTime = today;
                }
                if (dateTime.length < 4) {
                    var time = new Date();
                    var day = ("0" + time.getDate()).slice(-2);
                    var month = ("0" + (time.getMonth() + 1)).slice(-2);
                    var today = time.getFullYear() + "-" + (month);
                    dateTime = today;
                }
                table.reload('tableList',{
                    method:'get'
                    ,where:{
                        'date':dateTime
                        ,'stockId':keyword1
                    }
                    ,page: {
                        curr: 1//重新从第 1 页开始
                    }
                });
                getList($('#keyword1').val(),dateTime);
            }
        }
        var dateTime = $('#dateTime').val();
        var keyword1 = $("#keyword1").val();
        if (dateTime.length < 4) {
            var time = new Date();
            var day = ("0" + time.getDate()).slice(-2);
            var month = ("0" + (time.getMonth() + 1)).slice(-2);
            var today = time.getFullYear() + "-" + (month);
            dateTime = today;
        }
        table.render({
            elem: '#tableList',
            url: '/amoeba/listPartA.do',
            id:'tableList',
            totalRow: true,
            toolbar: '#toolbar',
            where:{
                'date':dateTime
                ,'stockId':keyword1
            }
            ,cols: [[
                {field: 'level1', title: '一级',width: 150},
                {field: 'level2', title: '二级', totalRowText: '合计=a1+a2',width:150}
                ,{field: 'level3', title: '三级',width:198,edit: 'text'}
                ,{field: 'detail', title: '明细',width:634,edit: 'text'}
                ,{field: 'price', title: '单价',width:86,edit: 'text'}
                ,{field: 'monery', title: '金额', totalRow: true,width:180,edit: 'text'}
                ,{field: 'remark', title: '备注'}
            ]]
            ,request: {   //如果无需自定义请求参数，可不加该参数
                pageName: 'page' //页码的参数名称，默认：page
                ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            ,response: {   //如果无需自定义数据响应名称，可不加该参数
                countName: 'total' //规定数据总数的字段名称，默认：count
                ,dataName: 'rows' //规定数据列表的字段名称，默认：data
            }
            ,done : function(res, curr, count){
                $('th').css({
                    'background-color': '#009688', 'color': '#fff','font-weight':'bold',
                })
                merge(res);
            }
        });

        //监听单元格编辑
        table.on('edit(tableList)', function(obj){

            if (obj.data.level2 != '内部部收入') {
                return false;
            }

            var value = obj.value //得到修改后的值
                ,data = obj.data //得到所在行所有键值
                ,fields = obj.field; //得到字段

            var dateTime = $('#dateTime').val();
            if (dateTime.length < 4) {
                var time = new Date();
                var day = ("0" + time.getDate()).slice(-2);
                var month = ("0" + (time.getMonth() + 1)).slice(-2);
                var today = time.getFullYear() + "-" + (month);
                dateTime = today;
            }
            dateTime = dateTime.replace(/-/g,'')
            var tem1 = obj.data.level3;
            var tem2 = obj.data.detail;
            var tem3 = obj.data.price;
            var tem4 = obj.data.monery;
            var tem5 = null;
            /*验证单价：包括两位小数*/
            var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;

            if ("level3" == fields) {
                tem1 = value
            }
            if ("detail" == fields) {
                tem2 = value
            }
            if ("price" == fields) {
                tem3 = value
                if (!priceReg.test(value)){
                    toastr.warning("请输入正确的价格:整数或者保留两位小数");
                    return false;
                }
            }
            if ("monery" == fields) {
                tem4 = value
                if (!priceReg.test(value)){
                    toastr.warning("请输入正确的价格:整数或者保留两位小数");
                    return false;
                }
            }

            $.ajax({
                type:"POST",
                url: "/amoeba/amoebaSave.do",
                //contentType: "application/json",
                data:{id:dateTime,parameter1:tem1,parameter2:tem2,parameter3:tem3,parameter4:tem4,parameter5:tem5,type:$('#keyword1').val()}
            })
        });

        $('.layui-col-md12 .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        $('.select .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        form.on('select(changType)', function(data){
            $("#brand1").hide()
            $("#brand2").hide()
            if (data.value == '租赁') {
                $("#brand1").show()
            }
            if (data.value == '折旧') {
                $("#brand2").show()
            }
        })

        $("#add").click(function(){
            $("#brand1").hide()
            $("#brand2").hide()

            layer.open({
                type: 1 ,				//Page层类型
                area: ['30%', '60%']
                ,title: '新增'
                ,shade: 0.6 			//遮罩透明度
                ,maxmin: true 			//允许全屏最小化
                ,anim: 1 				//0-6的动画形式，-1不开启
                ,content: $('#addDivID')
                ,success: function(){
                    form.render();
                }
            });
        })

        /**  data:{itemName:"12",startDate:'2019-09-20'},
         * 通用表单提交(AJAX方式),totalMoney:100,startDate:'2019-09-20',dueDate:'2019-09-20'
         */
        form.on('submit(addForm)', function () {

            $("#subBtn").attr("disabled",true);
            $.ajax({
                type:'post',
                url:'${pageContext.request.contextPath }/forkli/add.do',
                data:$('#addFormID').serialize(),
                cache:false,
            }).done(
                function(res) {
                    if (res > 0) {
                        toastr.success('新增成功！');
                        setTimeout(function(){
                            location.reload();
                        },1000);
                    }
                }
            ).fail(
                function() {
                    toastr.error('新增失败！');
                    setTimeout(function(){
                        location.reload();
                    },1000);
                }
            )
            return false;
        })

    });




    function merge(res) {


        var data = res.rows;
        var mergeIndex = 0;//定位需要添加合并属性的行数
        var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
        var columsName = ['level1','level2','remark'];//需要合并的列名称
        var columsIndex = [0,1,6];//需要合并的列索引值

        for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
            var trArr = $(".layui-table-body>.layui-table").find("tr");//所有行
            for (var i = 1; i < res.rows.length; i++) { //这里循环表格当前的数据
                var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
                var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列

                if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
                    mark += 1;
                    tdPreArr.each(function () {//相同列的第一列增加rowspan属性
                        $(this).attr("rowspan", mark);
                    });
                    tdCurArr.each(function () {//当前行隐藏
                        $(this).css("display", "none");
                    });
                }else {
                    mergeIndex = i;
                    mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
                }
            }
            mergeIndex = 0;
            mark = 1;
        }
    }

    toastrStyle()

</script>
</body>

</html>

